<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAddress extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_address', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->foreignId('user_id')->comment('用户ID');
            $table->string('name', 20)->nullable()->comment('用户名');
            $table->string('phone', 20)->nullable()->comment('手机号');
            $table->integer('province_id')->default(0)->comment('省');
            $table->integer('city_id')->default(0)->comment('市');
            $table->integer('area_id')->default(0)->comment('区');
            $table->string('address')->nullable()->comment('详细地址');
            $table->tinyInteger('default_flag')->default(0)->comment('是否默认 0否 1是');
            $table->boolean('status')->default(1)->comment('状态 1正常 0禁用');
            $table->tinyInteger('del_flag')->default(0)->comment('删除状态（1删除 0正常）');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_address');
    }
}
